﻿/// Write a program that deletes from a text file all words that start with the prefix "test".
/// Words contain only the symbols 0...9, a...z, A…Z, _.


// Regex.Matches(str, ">(.*?)<")
using System;
using System.IO;
using System.Text.RegularExpressions;


namespace c_sh_II_lek_6_files
{
    class zad11
    {
        static void Main()
        {
            string input = @"..\..\input.xml";
            string output = @"..\..\output.txt";

            using (StreamReader _in = new StreamReader(input))
            {
                using (StreamWriter _out = new StreamWriter(output))
                {
                    string line = _in.ReadLine();
                    while (line != null)
                    {
                        _out.WriteLine(Regex.Replace(line, @"\btest\w*\b", String.Empty));
                        line = _in.ReadLine();
                    }
                }

            }

            File.Delete(input);
            File.Copy(output, input);
            File.Delete(output);
        }
    }
}
